package com.hengpeng.itfinbase.persist;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Lob;

import com.hengpeng.common.persist.entity.AbstractTableAutoIdEntity;
import com.hengpeng.common.web.annotation.HtmlInput;
import com.hengpeng.common.web.annotation.HtmlInputPattern;
import com.hengpeng.common.web.annotation.HtmlInputType;

/**
 * 新闻评论
 * @author wuhaifei
 * @version 1.0 2012-11-22
 */
@Entity
public class ArticleDiscuss extends AbstractTableAutoIdEntity
{
	/**
	 * 评论状态
	 */
	public enum DiscussState
	{
		AUDIT("已审核"), MASK("已屏蔽"), NOAUDIT("待审核");

		private String text;

		DiscussState(String text)
		{
			this.text = text;
		}

		public String getText()
		{
			return text;
		}

		public void setText(String text)
		{
			this.text = text;
		}
	}

	private static final long serialVersionUID = -1158781164742291552L;

	@HtmlInput(label = "新闻ID", type = HtmlInputType.TEXT, index = 0, nullable = false)
	private Long articleId;

	@HtmlInput(label = "审核人", type = HtmlInputType.TEXT, index = 6)
	@Column(length = 30)
	private String auditor;

	@HtmlInput(label = "审核时间", type = HtmlInputType.TEXT, index = 7, pattern = HtmlInputPattern.DATETIME, format = "yyyy-MM-dd HH:mm")
	private Date auditTime;

	@HtmlInput(label = "评论内容", type = HtmlInputType.TEXTAREA, index = 2, nullable = false)
	@Lob
	private String discussContent;

	@HtmlInput(label = "评论人IP", type = HtmlInputType.TEXT, index = 8)
	private String ip;

	@HtmlInput(label = "评论时间", type = HtmlInputType.TEXT, index = 3, nullable = false, pattern = HtmlInputPattern.DATETIME, format = "yyyy-MM-dd HH:mm")
	private Date publishTime;

	@HtmlInput(label = "评论状态", type = HtmlInputType.SELECT, index = 4, nullable = false, labelProperty = "text")
	@Column(length = 10)
	@Enumerated(EnumType.STRING)
	private DiscussState state;

	@HtmlInput(label = "评论人", type = HtmlInputType.TEXT, index = 1, nullable = false)
	@Column(length = 50)
	private String userName;

	public Long getArticleId()
	{
		return articleId;
	}

	public String getAuditor()
	{
		return auditor;
	}

	public Date getAuditTime()
	{
		return auditTime;
	}

	public String getDiscussContent()
	{
		return discussContent;
	}

	public String getIp()
	{
		return ip;
	}

	public Date getPublishTime()
	{
		return publishTime;
	}

	public DiscussState getState()
	{
		return state;
	}

	public String getUserName()
	{
		return userName;
	}

	public void setArticleId(Long articleId)
	{
		this.articleId = articleId;
	}

	public void setAuditor(String auditor)
	{
		this.auditor = auditor;
	}

	public void setAuditTime(Date auditTime)
	{
		this.auditTime = auditTime;
	}

	public void setDiscussContent(String discussContent)
	{
		this.discussContent = discussContent;
	}

	public void setIp(String ip)
	{
		this.ip = ip;
	}

	public void setPublishTime(Date publishTime)
	{
		this.publishTime = publishTime;
	}

	public void setState(DiscussState state)
	{
		this.state = state;
	}

	public void setUserName(String userName)
	{
		this.userName = userName;
	}

}
